from nacos_client import client
import time


# 服务注册
client.add_naming_instance("mobots", "127.0.0.1", port=8084)

while True:
    try:
        client.send_heartbeat("mobots", "127.0.0.1", port=8084)
        time.sleep(30)
    except Exception as e:
        print(f"Error: {e}")
        time.sleep(5)  # 在尝试重新发送心跳之前稍作延迟
